package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.verbetia.musictrends.persistence.hsqldb.MusicEntity;
import com.verbetia.musictrends.persistence.hsqldb.UserEntity;

public final class home_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/index.jsp");
  }

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write(" <link rel=\"stylesheet\" href=\"reset.css\" media=\"all\" type=\"text/css\" />\r\n");
      out.write(" <link rel=\"stylesheet\" href=\"main.css\" media=\"all\" type=\"text/css\" />\r\n");
      out.write(" <link rel=\"stylesheet\" href=\"h-brown.css\" media=\"all\" type=\"text/css\" />\r\n");
      out.write(" <link rel=\"stylesheet\" href=\"n-blue.css\" media=\"all\" type=\"text/css\" />\r\n");
      out.write("<style type=\"text/css\" media=\"all\">\r\n");
      out.write("\r\n");
      out.write("    body {\r\n");
      out.write("        background-position: center top;\r\n");
      out.write("                \r\n");
      out.write("                    background-color: #e5f1f4;\r\n");
      out.write("                \r\n");
      out.write("                background-image: url(snowbud.gif);\r\n");
      out.write("                background-repeat: repeat;\r\n");
      out.write("            \r\n");
      out.write("        \r\n");
      out.write("    }\r\n");
      out.write("    \r\n");
      out.write("    a:link,\r\n");
      out.write("    a:visited,\r\n");
      out.write("    ul.notes li.ad-note .note-contents a em,\r\n");
      out.write("    .ad-example a, a:hover,\r\n");
      out.write("    a:active,\r\n");
      out.write("    a.add-new {\r\n");
      out.write("                \r\n");
      out.write("                    color: #2e8696;\r\n");
      out.write("                \r\n");
      out.write("          \r\n");
      out.write("    }\r\n");
      out.write("    \r\n");
      out.write("    .cloud0 { font-size: 1.00em; }\r\n");
      out.write("\t.cloud1 { font-size: 1.10em; }\r\n");
      out.write("\t.cloud2 { font-size: 1.20em; }\r\n");
      out.write("\t.cloud3 { font-size: 1.30em; }\r\n");
      out.write("\t.cloud4 { font-size: 1.40em; }\r\n");
      out.write("\t.cloud5 { font-size: 1.50em; }\r\n");
      out.write("\t.cloud6 { font-size: 1.60em; }\r\n");
      out.write("\t.cloud7 { font-size: 1.70em; }\r\n");
      out.write("\t.cloud8 { font-size: 1.80em; }\r\n");
      out.write("\t.cloud9 { font-size: 1.90em;  }\r\n");
      out.write("    \r\n");
      out.write("    \r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<body>\r\n");
      out.write("   <div id=\"side-1\">       \r\n");
      out.write("<div class=\"intro vcard\">\r\n");
      out.write("    \r\n");
      out.write("    <div id=\"main\">        \r\n");
      out.write("            <div id=\"header\">\r\n");
      out.write("            <div id=\"header-contents\">       \r\n");
      out.write("<div id=\"nav-primary\">\r\n");
      out.write("MusicSeach \r\n");
      out.write("<br>\r\n");
 if (session.getAttribute("username")!=null) { 
      out.write("\r\n");
      out.write("<a href=\"home.jsp\">[Your Music]</a>\r\n");
      out.write("<a href=\"logout\">[Logout ");
      out.print(session.getAttribute("username"));
      out.write("]</a>\r\n");
 } else {  
      out.write("\r\n");
      out.write("<a href=\"login.jsp\">[Login]</a>\r\n");
      out.write("<a href=\"register.jsp\">[SingUp]</a>\r\n");
 } 
      out.write("\r\n");
      out.write("<form name=\"input\" action=\"result.jsp\" method=\"get\">\r\n");
      out.write("Search: \r\n");
      out.write("<input type=\"text\" name=\"q\">\r\n");
      out.write("<input type=\"submit\" value=\"Submit\">\r\n");
      out.write("</form>               \r\n");
      out.write("</div></div></div></div>\r\n");
      out.write("</div></div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      com.verbetia.musictrends.web.music.ViewMusic home = null;
      synchronized (_jspx_page_context) {
        home = (com.verbetia.musictrends.web.music.ViewMusic) _jspx_page_context.getAttribute("home", PageContext.PAGE_SCOPE);
        if (home == null){
          home = new com.verbetia.musictrends.web.music.ViewMusic();
          _jspx_page_context.setAttribute("home", home, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
 UserEntity prof = (UserEntity)session.getAttribute("User"); 
      out.write("\r\n");
      out.write("\r\n");
      out.write(" <div id=\"content\">           \r\n");
      out.write("        <div id=\"page\"><div id=\"page-contents\">\r\n");
      out.write("\r\n");
      out.write("<h1>");
      out.print( session.getAttribute("username").toString () );
      out.write(" listened music:</h1>\r\n");
      out.write("<a href=\"rss.jsp?u=");
      out.print( prof.getUserid() );
      out.write("\">RSS <img src=\"./img/feed-icon-14x14.png\" alt=\"my feed\"/></a>\r\n");
      out.write("<br>\r\n");
      out.write("<table>\r\n");
      out.write("\r\n");
 java.util.ArrayList a = home.processSongs( session.getAttribute("User") ); 

  if (a!=null)
   for (int i=0; i!=a.size(); i++)
   { 
		MusicEntity m = (MusicEntity)a.get(i);   
   
      out.write("\r\n");
      out.write("\t<tr>\r\n");
      out.write("\t <td><h1>");
      out.print( m.getTitle() );
      out.write("<h1></td>\r\n");
      out.write("\t <td><h3>");
      out.print( m.getArtist() );
      out.write("</h3></td>\r\n");
      out.write("\t <td><h3>");
      out.print( m.getAlbum() );
      out.write("</h3></td>\r\n");
      out.write("\t <td><h3>");
      out.print( m.getDateFormated("HH:mm:ss MM/dd/yy") );
      out.write("</h3></td>\r\n");
      out.write("\t <td><a href=\"");
      out.print( m.getAmazonid() );
      out.write("\"><img src=\"");
      out.print( m.getAmazonid() );
      out.write("\" alt=\"");
      out.print( m.getAlbum() );
      out.write("\" height=\"60\" width=\"60\" /></a></td>\t\r\n");
	 if (session.getAttribute("username")!=null) { 
      out.write("\r\n");
      out.write(" \t <td><a href=\"delete?iid=");
      out.print( m.getId() );
      out.write("\"><img src=\"./img/delete.png\" alt=\"del\" /></a></td>\r\n");
      out.write("\t");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t</tr>\r\n");
      out.write("\r\n");
      out.write(" ");
  }
      out.write("\r\n");
      out.write(" </table>\r\n");
      out.write(" \r\n");
      out.write("</div></div></div>\r\n");
      out.write("  \r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
